#version 330 core

layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aCol;
layout (location = 2) in vec2 aTexCoord;

out vec3 oCol;
out vec3 oPos;
out vec2 oTexCoord;

uniform float uW;
uniform float uH;

uniform mat4 uModel;
uniform mat4 uView;

void main() {

    vec3 pos = aPos;
    float r = uW / uH;
    if (uW < uH) {
        pos.x *= r;
    } else {
        pos.y *= r;
    }

    mat4 scale = mat4(vec4(0.6, 0.0, 0.0, 0.0), vec4(0.0, 0.6, 0.0, 0.0), vec4(0.0, 0.0, 0.6, 0.0), vec4(0.0, 0.0, 0.0, 1.0));

    gl_Position = uView * uModel * scale * vec4(pos, 1.0);
    oCol = aCol;
    oPos =  pos;
    oTexCoord = aTexCoord;
}
